<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
request.setAttribute("path", path);
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh">
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'addCurriculumcard.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!-- bootstrap的 -->
	<link rel="stylesheet" href="${path }/bootstrap/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
	<script src="${path }/bootstrap/js/jquery-slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="${path }/bootstrap/js/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="${path }/bootstrap/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
	<!-- 基本的 -->
	<link href="${path }/css/haiersoft.css" rel="stylesheet" type="text/css" media="screen,print" />
	<script src="${path }/projectView/js/side.js" type="text/javascript"></script>
	<!-- jquery 会与bootstrap的jquery发生冲突-->
<%-- 	<script src="${path }/projectView/bootstrap/js/jquery-3.2.1.js" type="text/javascript"></script> --%>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->


	<script type="text/javascript">
		 $(function(){
		 	$("#curriculumcardTable button").click(function(){
		 		var url=$(this).attr('gohref');
		 		$.ajax({
		 			type:"get",
		 			url:url,
		 			dataType:"json",
		 			success:function(data){
		 				
		 			}
		 		});
		 		$("#exampleModal").modal('show');
		 	});
		 });
	</script>
	
  </head>
  
  <body>
 <!-- wrap_right -->
<div class="wrap_right">
<header>
<!-- Header -->

<!-- /Header -->
</header>

<!-- Contents -->
<div id="Contents">   

	<!-- MainForm -->
	<div id="MainForm">
	<div class="form_boxA">
	<h2>${t_Class.classname }课程表安排</h2>
	<table cellpadding="0" cellspacing="0" id="curriculumcardTable">
	<tr>
		<th>&nbsp;</th>
		<th>星期一</th>
		<th>星期二</th>
		<th>星期三</th>
		<th>星期四</th>
		<th>星期五</th>
	</tr>
	<jstl:forEach items="${datenumberList }" var="datenumber">
		<tr>
			<td>${datenumber.name }</td>
			<td>
				<button type="button" class="btn btn-primary" gohref="${pageContext.request.contextPath }/Curriculumcard/goAdd?curriculumdate=${datenumber.id}">
					<jstl:set var="updateOrAdd" value="添加信息" scope="page"></jstl:set>
					<jstl:forEach items="${curriculumcardList }" var="curriculumcard" >
						<jstl:if test="${(datenumber.id) eq curriculumcard.curriculumdate}">
							<jstl:set var="updateOrAdd" value="修改信息" scope="page"></jstl:set>
						</jstl:if>
					</jstl:forEach>
					${pageScope.updateOrAdd }
				</button>
			</td>
			<td>
				<button type="button" class="btn btn-primary" gohref="${pageContext.request.contextPath }/Curriculumcard/goAdd?curriculumdate=${10+datenumber.id}">
					<jstl:set var="updateOrAdd" value="添加信息" scope="page"></jstl:set>
					<jstl:forEach items="${curriculumcardList }" var="curriculumcard" >
						<jstl:if test="${(10+datenumber.id) eq curriculumcard.curriculumdate}">
							<jstl:set var="updateOrAdd" value="修改信息" scope="page"></jstl:set>
						</jstl:if>
					</jstl:forEach>
					${pageScope.updateOrAdd }
					
				</button>
			</td>
			<td>
				<button type="button" class="btn btn-primary" gohref="${pageContext.request.contextPath }/Curriculumcard/goAdd?curriculumdate=${20+datenumber.id}">
					<jstl:set var="updateOrAdd" value="添加信息" scope="page"></jstl:set>
					<jstl:forEach items="${curriculumcardList }" var="curriculumcard" >
						<jstl:if test="${(20+datenumber.id) eq curriculumcard.curriculumdate}">
							<jstl:set var="updateOrAdd" value="修改信息" scope="page"></jstl:set>
						</jstl:if>
					</jstl:forEach>
					${pageScope.updateOrAdd }
				</button>
			</td>
			<td>
				<button type="button" class="btn btn-primary" gohref="${pageContext.request.contextPath }/Curriculumcard/goAdd?curriculumdate=${30+datenumber.id}">
					<jstl:set var="updateOrAdd" value="添加信息" scope="page"></jstl:set>
					<jstl:forEach items="${curriculumcardList }" var="curriculumcard" >
						<jstl:if test="${(30+datenumber.id) eq curriculumcard.curriculumdate}">
							<jstl:set var="updateOrAdd" value="修改信息" scope="page"></jstl:set>
						</jstl:if>
					</jstl:forEach>
					${updateOrAdd }
				</button>
			</td>
			<td>
				<button type="button" class="btn btn-primary" gohref="${pageContext.request.contextPath }/Curriculumcard/goAdd?curriculumdate=${40+datenumber.id}">
					<jstl:set var="updateOrAdd" value="添加信息" scope="page"></jstl:set>
					<jstl:forEach items="${curriculumcardList }" var="curriculumcard" >
						<jstl:if test="${(40+datenumber.id) eq curriculumcard.curriculumdate}">
							<jstl:set var="updateOrAdd" value="修改信息" scope="page"></jstl:set>
						</jstl:if>
					</jstl:forEach>
					${updateOrAdd }
				</button>
			</td>
		</tr>
	</jstl:forEach>

	</table>
	
	<!-- 模态框 -->
	<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
	  <div class="modal-dialog" role="document">
	    <div class="modal-content">
	      <div class="modal-header">
	        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
	          <span aria-hidden="true">&times;</span>
	        </button>
	      </div>
	      <!-- 表单部分 -->
	      <div class="modal-body">
	        <form id="curriculumcardAddForm">
	          <!-- 哪一个班 -->
	          <input type="hidden" name="curriculumclassid" value="${t_Class.id }" />
	          <!-- 星期几的第几节课 -->
	          <input type="hidden" id="curriculumdateHidden" name="curriculumdate" value="-1">
			  <div class="form-group">
 				<label for="exampleFormControlSelect1">教室选择:</label>
			    <select class="form-control" name="curriculumclassid" id="classRoomSelect">
			      <option>1</option>
			      <option>2</option>
			    </select>
			  </div>
			  <div class="form-group">
			    <label for="exampleFormControlSelect1">教师选择:</label>
			    <select class="form-control" name="curriculumteacherid" id="teacherSelect">
			      <option>1</option>
			      <option>2</option>
			    </select>
			  </div>
			  <div class="form-group">
			    <label for="exampleFormControlSelect1">课程选择:</label>
			    <select class="form-control" name="curriculumid" id="curriculumSelect">
			      <option>1</option>
			      <option>2</option>
			    </select>
			  </div>
			</form>
	      </div>
	      
	      <div class="modal-footer">
	        <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
	        <button type="button" class="btn btn-primary">保存</button>
	      </div>
	    </div>
	  </div>
	</div>
	
	<p class="msg">正在排课...</p>
	</div>
	</div>
	<!-- /MainForm -->
	</div>
</div>
  </body>
</html>
